package com.heima.mapper;

import com.github.pagehelper.Page;
import com.heima.pojo.VmType;
import com.heima.pojo.dto.VmPageDTO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface VmMapper {

    /**
     * 分页查询
     */
    Page<VmType> pageQuery(VmPageDTO vmPageDTO);

    @Select("select * from tb_vm_type where name = #{name}")
    VmType query(VmType vmType);

    /**
     * 新增设备类型
     */
    @Insert("insert into tb_vm_type (vm_row,vm_col,name,channel_max_capacity,model,image)" +
            "values(#{vmRow},#{vmCol},#{name},#{channelMaxCapacity},#{model},#{image})")
    void insert(VmType vmType);

    /**
     * 售货机类型修改
     */
    void update(VmType vmType);

    /**
     * 售货机类型删除
     */
    @Delete("delete from tb_vm_type where type_id = #{typeId}")
    void delete(Integer typeId);
}
